home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / powerd / lib / powerd.lha / powerd_ppc / StrAdd.ass < prev    next >
Encoding:
Text File  |  1980-10-15  |  548 b   |  28 lines

  1.  
  2. # StrAdd(r3:PTR TO CHAR,r4:PTR TO CHAR,r5=-1:LONG)
  3.  
  4.     .text
  5.     .global    _StrAdd
  6.  
  7. _StrAdd:
  8.     subi    r6,r3,1        # find the end of the destination string
  9. .find:    lbzu    r0,1(r6)
  10.     mr.    r0,r0
  11.     bne    .find
  12.  
  13.     subi    r4,r4,1
  14.     subi    r6,r6,1
  15. .loop:    lbzu    r0,1(r4)        # get char from source
  16.     stbu    r0,1(r6)        # put char to destination
  17.     mr.    r0,r0        # source end?
  18.     beq    .finish
  19.     subi    r5,r5,1        # length done?
  20.     mr.    r5,r5
  21.     bne    .loop
  22.     li    r0,0        # finish with zero byte
  23.     stb    r0,1(r6)
  24. .finish:    blr            # r3 contains destination string pointer
  25.  
  26.     .type    _StrAdd,@function
  27.     .size    _StrAdd,$-_StrAdd
  28.